package org.bbs.demo.user.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.bbs.demo.user.dto.UserUpdateInfoDto;
import org.bbs.demo.user.dto.UserUpdatePwdDto;
import org.bbs.demo.user.model.User;

@Mapper
public interface UserUpdateDao {

    // 更新用户个人信息
    @Update("update bbsusers set u_name=#{u_name}, birth=#{birth}, " +
            "sex=#{sex}, signature=#{signature}, school=#{school}, " +
            "major=#{major}, phone=#{phone} where user_id=#{user_id}")
    public int updateUserInfo(UserUpdateInfoDto userUpdateInfoDto);

    // 更新用户密码
    @Update("update bbsusers set password=#{newPwd} where user_id=#{user_id} and password=#{oldPwd}")
    public int updateUserPwd(UserUpdatePwdDto userUpdatePwdDto);
}

